<template>
    <!-- 销售审核 -->
    <div>
        <el-card>
            <div slot="header" class="clearfix">
                <span style="line-height: 36px;">客户信息审核</span>
            </div>
            <policy-list v-if="show" :type="'客户信息审核'" ref="list" @goCheckF="goCheckF">
            </policy-list>
        </el-card>
        <div class="space20">
        </div>
        <el-card>
            <div slot="header" class="clearfix">
                <span style="line-height: 36px;">投保单审核</span>
            </div>
            <policy-list v-if="show" :type="'投保单审核'" ref="list2" @goCheckS="goCheckS">
            </policy-list>
        </el-card>
        <el-dialog title="审核" :visible.sync="checkShow" v-if="checkShow" size="large">

            <el-form ref="form" label-width="80px" :model="saleDetail">
                <el-form-item label="审核">
                    <el-select v-model="saleDetail.SALESDETAIL_CHECKSTATE" placeholder="请审核" v-show="type=='客户信息审核'">
                        <el-option label="审核通过" value="需上传投保单"></el-option>
                        <el-option label="审核不通过" value="审核不通过"></el-option>
                    </el-select>
                    <el-select v-model="saleDetail.SALESDETAIL_CHECKSTATE" placeholder="请审核" v-show="type=='投保单审核'">
                        <el-option label="审核通过" value="需缴费确认"></el-option>
                        <el-option label="审核不通过" value="审核不通过"></el-option>
                    </el-select>                  
                </el-form-item>
              
                <el-form-item label="审核意见">
                    <el-input type="textarea" v-model="saleDetail.SALESDETAIL_CHECKMESSAGE"></el-input>
                </el-form-item>

                  <el-form-item   label="投保单" v-if="type=='投保单审核'">
                      <el-button type='primary' @click="dowload()" >
                                        下载
                                    </el-button>
                </el-form-item>
            </el-form>
            <div style="height:600px; overflow:scroll">
                <policy-show :type="type" @close="close">
                </policy-show>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import api from "@/js/api";
import { mapState } from "vuex";
import PolicyList from "@/components/Sell/PolicyList";
import PolicyShow from "@/components/Sell/policyShow";
export default {
  data() {
    return {
      show: false,
      checkShow: false,
      type: "",
      doc:''
    };
  },
  components: {
    "policy-list": PolicyList,
    "policy-show": PolicyShow
  },
  computed: mapState({
    saleDetail: state => state.SealDetail.model
  }),
  activated() {
    this.show = true;
    try {
      this.$refs.list.getDate();
      this.$refs.list2.getDate();
    } catch (error) {}
  },
  methods: {
    goCheckF() {
      // console.log( this.saleDetail.SALESDETAIL_CHECKSTATE);

      //  console.log(this.saleDetail.SALESDETAIL_CHECKSTATE);
      this.checkShow = true;
      this.type = "客户信息审核";
    },
    goCheckS(obj) {
      //  this.saleDetail.SALESDETAIL_CHECKSTATE="";
      this.checkShow = true;
      this.type = "投保单审核";
      
      this.doc=obj.SALESDETAIL.SALESDETAIL_DOC
    },
    dowload(name) {
      var url = this.doc;
      window.open(api.download(url));
      //   console.log(url);
    },
    close() {
      this.checkShow = false;
      try {
        this.$refs.list.getDate();
        this.$refs.list2.getDate();
      } catch (error) {}
    }
  }
};
</script>

<style>

</style>
